package com.reservation.controller.staff;

import com.reservation.dto.staff.StartUseDTO;
import com.reservation.result.Result;
import com.reservation.service.StaffService;
import com.reservation.vo.staff.TodayReserveItemVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "员工管理相关接口")
@RestController
@RequestMapping("/api/staff")
@Slf4j
public class TodayReserveController {

    @Autowired
    private StaffService staffService;

    /**
     * 获取今日预约列表
     *
     * @return 今日预约列表
     */
    @PostMapping("/getTodayReserveList")
    @ApiOperation("获取今日预约列表")
    public Result<List<TodayReserveItemVO>> getTodayReserveList() {
        log.info("获取今日预约列表");
        List<TodayReserveItemVO> list = staffService.getTodayReserveList();
        return Result.success(list);
    }

    /**
     * 开始使用
     * @param startUseDTO 开始使用参数
     */
    @PostMapping("/startUse")
    @ApiOperation("开始使用")
    public Result<String> startUse(@RequestBody StartUseDTO startUseDTO) {
        log.info("开始使用会议室，预约ID: {}", startUseDTO.getId());
        return staffService.startUse(startUseDTO) ?
                Result.success("操作成功") :
                Result.error("操作失败，请重试");
    }
}
